package cn.enilu.flash.bean.entity.cust;

import cn.enilu.flash.bean.entity.BaseEntity;
import lombok.Data;
import org.hibernate.annotations.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Description
 * @Author Spark
 * @Date Created in (2019/10/31 14:58)
 * @Version v1.0
 * @Modify
 **/
@Entity(name="cust_info")
@Table(appliesTo = "cust_info",comment = "客户信息")
@Data
@EntityListeners(AuditingEntityListener.class)
public class CustInfo extends BaseEntity {
    @Column(name = "mobile", columnDefinition = "VARCHAR(11) COMMENT '手机号'")
    @NotNull(message = "手机号不能为空")
    private String mobile;

    @Column(name = "card_type", columnDefinition = "INT COMMENT '证件类型'")
    @NotNull(message = "证件类型不能为空")
    private Integer cardType;

    @Column(name = "card_no", columnDefinition = "VARCHAR(18) COMMENT '证件号码'")
    @NotNull(message = "证件号码不能为空")
    private String cardNo;

    @Column(name = "name", columnDefinition = "VARCHAR(64) COMMENT '姓名'")
    @NotNull(message = "姓名不能为空")
    private String name;

    @Column(name = "avatar", columnDefinition = "VARCHAR(255) COMMENT '头像'")
    private String avatar;

    @Column(name = "gender", columnDefinition = "INT COMMENT '性别'")
    @NotNull(message = "性别不能为空")
    private Integer gender;

    @Column(name = "registe_addr", columnDefinition = "VARCHAR(512) COMMENT '身份证注册地'")
    @NotNull(message = "身份证注册地不能为空")
    private String registeAddr;

    @Column(name = "contacts_name", columnDefinition = "VARCHAR(64) COMMENT '紧急联系人'")
    private String contactsName;

    @Column(name = "contacts_tel", columnDefinition = "VARCHAR(32) COMMENT '联系人电话号'")
    private String contactsTel;

    @Column(name = "owner_flag", columnDefinition = "INT COMMENT '客户类型'")
    @NotNull(message = "客户类型不能为空")
    private Integer ownerFlag;

    @Column(name = "email", columnDefinition = "VARCHAR(128) COMMENT '电子邮件'")
    private String email;

    @Column(name = "wx", columnDefinition = "VARCHAR(128) COMMENT '微信号'")
    private String wx;

    @Column(name = "qq", columnDefinition = "VARCHAR(128) COMMENT 'QQ号'")
    private String qq;

    @Column(name = "home_tel", columnDefinition = "VARCHAR(128) COMMENT '座机号'")
    private String homeTel;

    @Column(name = "card_front_file_id", columnDefinition = "BIGINT COMMENT '证件正面照'")
    private Long cardFrontFileId;

    @Column(name = "card_back_file_id", columnDefinition = "BIGINT COMMENT '证件反面照'")
    private Long cardBackFileId;

    @Column(name = "contract_file_id", columnDefinition = "BIGINT COMMENT '合同文件'")
    private Long contractFileId;

    @Column(name = "state", columnDefinition = "INT COMMENT '状态'")
    @NotNull(message = "状态不能为空")
    private Integer state;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "in_date", columnDefinition = "DATETIME COMMENT '入住日期'")
    private Date inDate;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "out_date", columnDefinition = "DATETIME COMMENT '搬离日期'")
    private Date outDate;

}
